// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import axios from 'axios'

import "./assets/main.css"

import {get3DBarData} from './3D_bar'
import {getDisCountBar} from "./district_Count_Bar"
import {updateTitleText} from "./header"
import {getMapData} from "./map"
import {getPieAllData} from "./pie"
import {updateSalaryBar} from "./salary_Bar"
import {getWordCount} from "./wordCloud"

Vue.config.productionTip = false

axios.defaults.baseURL = "http://localhost:8081/api/"      

/* eslint-disable no-new */
const app = new Vue({
  el: '#offcanvasTop',
  data(){
          return {
          search: "",
          city: '',
          cityList: ["柳州", "南宁", "深圳", "广州"]
      }
  },
    computed: {
      filtered() {
          return this.cityList.filter(
              (data) =>
                  !this.search ||
                  data.toLowerCase().includes(this.search.toLowerCase())
          )
      }
  }
})

app.$watch('city', function (nval, oval) {
  updateTitleText(nval)
  getMapData(nval)
  get3DBarData(nval)
  getPieAllData(nval)
  getDisCountBar(nval)
  getWordCount(nval)
  updateSalaryBar(nval)
});